package com.layer.cms.generate.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.layer.cms.generate.mapper.CodeGenerateConfigMapper;
import com.layer.cms.generate.pojo.CodeGenerateConfig;
import com.layer.cms.generate.service.CodeGenerateConfigService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CodeGenerateConfigServiceImpl extends ServiceImpl<CodeGenerateConfigMapper, CodeGenerateConfig> implements CodeGenerateConfigService {

	@Override
	public void saveConfig(List<CodeGenerateConfig> list) {

		// 删除以往旧数据
		list.forEach(e -> {
			this.remove(new LambdaQueryWrapper<CodeGenerateConfig>().eq(CodeGenerateConfig::getCodeGenId, e.getCodeGenId()));
		});

		this.saveBatch(list);
	}

}
